#ifndef _FAKEOS_TYPES_H
#define _FAKEOS_TYPES_H

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

//判断是否是Mac系统，如果是，需要改.data.fakeos -> .data,fakeos
#if defined(__APPLE__)
#  define FAKEOS_DATA_SECTION ".data,fakeos_data"
#  define FAKEOS_TEXT_SECTION ".text,fakeos_text"
#else
#  define FAKEOS_DATA_SECTION ".data.fakeos"
#  define FAKEOS_TEXT_SECTION ".text.fakeos"
#endif

#if defined(__GNUC__)
//将变量放到fakeos_data段，需要根据GCC，KEIL，IAR等工具的不同，使用不同的宏
#  define MY_UINT8_T(x) (uint8_t x __attribute__((section(FAKEOS_DATA_SECTION)))) 
#  define MY_UINT16_T(x) (uint16_t x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_UINT32_T(x) uint32_t x __attribute__((section(FAKEOS_DATA_SECTION)))
#  define MY_INT8_T(x) (int8_t x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_INT16_T(x) (int16_t x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_INT32_T(x) (int32_t x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_FLOAT(x) (float x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_DOUBLE(x) (double x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_STRUCT(s, v) (s x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_UNION(s, v) (s x __attribute__((section(FAKEOS_DATA_SECTION))))
#  define MY_FUNC_SECTION __attribute__((section(FAKEOS_DATA_SECTION)))
#elif defined(__CC_ARM)
#elif defined(__ICCARM__)
#elif defined(_MSC_VER)
#  pragma section(FAKEOS_DATA_SECTION, read, write)
#  pragma section(FAKEOS_TEXT_SECTION, execute, read)
#  define MY_UINT8_T(x) __declspec(allocate(".fakeos.data")) uint8_t x
#  define MY_UINT16_T(x) __declspec(allocate(".fakeos.data")) uint16_t x
#  define MY_UINT32_T(x) __declspec(allocate(".fakeos.data")) uint32_t x
#  define MY_INT8_T(x) __declspec(allocate(".fakeos.data")) int8_t x
#  define MY_INT16_T(x) __declspec(allocate(".fakeos.data")) int16_t x
#  define MY_INT32_T(x) __declspec(allocate(".fakeos.data")) int32_t x
#  define MY_FLOAT(x) __declspec(allocate(".fakeos.data")) float x
#  define MY_DOUBLE(x) __declspec(allocate(".fakeos.data")) double x
#  define MY_STRUCT(s, v) __declspec(allocate(".fakeos.data")) s x
#  define MY_UNION(s, v) __declspec(allocate(".fakeos.data")) s x
#  define MY_FUNC_SECTION __declspec(allocate(".fakeos.text"))
#endif




typedef uint8_t fakeos_event_t;
typedef uint8_t fakeos_process_num_events_t;

typedef uint32_t clock_time_t;

#define EV_PROCESS_NONE            0x00
#define EV_PROCESS_USER_MIN        0x01
#define EV_PROCESS_USER_MAX        0xEF
#define EV_PROCESS_SYS_INIT            0xF1
#define EV_PROCESS_SYS_POLL            0xF2
#define EV_PROCESS_SYS_EXIT            0xF3
#define EV_PROCESS_SYS_SERVICE_REMOVED 0xF4
#define EV_PROCESS_SYS_CONTINUE        0xF5
#define EV_PROCESS_SYS_MSG             0xF6
#define EV_PROCESS_SYS_EXITED          0xF7
#define EV_PROCESS_SYS_TIMER           0xF8
#define EV_PROCESS_SYS_COM             0xF9
#define EV_PROCESS_SYS_MAX             0xFF

#ifdef __cplusplus
}
#endif

#endif
